-
Notifications
You must be signed in to change notification settings - Fork 382
fix: orgunit n+1 queries by skipping query cache #22711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
david-mackessy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always good to avoid the n+1 - nice 👍
Are we getting to a place where OrgUnits are never cached now?
Are we fully aware of any wider implications of the change? (All of these may not be relevant)
- potential downsides of the change
- some calls will be better, some will be worse
- many more DB queries for one of the most queried objects in the system
We have the ability to add tests that check the number of SQL queries executed - could it be useful here?
…_skip_orgunit_querycache
…_skip_orgunit_querycache
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
…_skip_orgunit_querycache
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
…_skip_orgunit_querycache
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
Signed-off-by: Morten Svanaes <msvanaes@dhis2.org>
|



This pull request disables the query cache for
OrganisationUnitobjects to improve performance and avoid issues with N+1 queries during hydration ofOrganisationUnitobjects. The N+1 issue seen when doingOrganisationUnitqueries was caused by Hibernate when it was hydrating the objects from the query cache and needed to set the parent, which is only represented by an ID in the cache, and hence it needed to fetch the whole object from the database for each result object.